#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
int main()
{
    printf("running\n");
    pid_t id = fork();
    if(id == 0)
    {
        //子进程
        sleep(5);
        printf("i am child process,pid:%d,ppid:%d\n",getpid(),getppid());
        exit(1);
    }
    sleep(10);
    int status =0;
    pid_t rid = waitpid(id,&status,0);
    if(rid == id)
    {

        printf("i am father process,pid:%d,ppid:%d\n",getpid(),getppid());
        printf("child process exit,status:%d,sig code:%d,exit code:%d\n",status,WTERMSIG(status),WEXITSTATUS(status));
    }
    return 0;
}
